<template>
	<div>
	<el-table :data="tableData" stripe style="width: 100%">
		<el-table-column prop="id" label="主键" width="180"></el-table-column>
		<el-table-column prop="b_name" label="姓名" width="180"></el-table-column>
		<el-table-column prop="b_pwd" label="密码"></el-table-column>
	</el-table>
	<el-pagination
	  background
	  layout="prev, pager, next"
	  :total="total"
	  :page-size="pageSize"
	  @current-change="getNow">
	</el-pagination>
	</div>
</template>

<script>
export default {
	data() {
		return {
			tableData: [],
			total:4,
			pageSize:2,
			pageNow:1
		};
	},
	created() {
		this.getPage();
	},
	methods:{
		getNow:function(a){
			this.pageNow=a;
			this.getPage();
		},
		getPage:function(){
			var _this=this;
			_this.$ajax.get('http://1319.cc/fa', {
			    params: {
			      page:_this.pageNow
			    }
			  })
			  .then(function (response) {
			    console.log(response);
				_this.tableData=response.data.data.data;
				_this.total=response.data.data.total;
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
		}
	}
};
</script>
